# coding: utf-8
import enum

from json_encoder import OutputMixin
from orm_app import db


class GenderEnum(enum.Enum):
    男 = '男'
    女 = '女'
    其他 = '其他'


t_score = db.Table(
    'score',
    db.Column('course', db.String(50)),
    db.Column('score', db.Integer),
    db.Column('student_id', db.Integer)
)


class Student(OutputMixin, db.Model):
    __tablename__ = 'student'  # 不写默认为类名小写

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100), nullable=False)
    birth = db.Column(db.DateTime, nullable=False)
    gender = db.Column(db.Enum(GenderEnum), nullable=False)
